<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/doc/src/richtext.qdoc -->
<head>
  <title>Qt 4.3: Advanced Rich Text Processing</title>
  <link rel="prev" href="richtext-common-tasks.html" />
  <link rel="contents" href="richtext.html" />
  <link rel="next" href="richtext-html-subset.html" />
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><p>
[Previous: <a href="richtext-common-tasks.html">Common Rich Text Editing Tasks</a>]
[<a href="richtext.html">Contents</a>]
[Next: <a href="richtext-html-subset.html">Supported HTML Subset</a>]
</p>
<h1 align="center">Advanced Rich Text Processing<br /><small></small></h1>
<a name="handling-large-files"></a>
<h2>Handling Large Files</h2>
<p>Qt does not limit the size of files that are used for text processing. In most cases, this will not present a problem. For especially large files, however, you might experience that your application will become unresponsive or that you will run out of memory. The size of the files you can load depends on your hardware and on Qt's and your own application's implementation.</p>
<p>If you are faced with this problem, we recommend that you address the following issues:</p>
<ul>
<li>You should consider breaking up large paragraphs into smaller ones as Qt handles small paragraphs better. You could also insert line breaks at regular intervals, which will look the same as one large paragraph in a <a href="qtextedit.html">QTextEdit</a>.</li>
<li>You can reduce the amount of blocks in a <a href="qtextdocument.html">QTextDocument</a> with <a href="qtextdocument.html#maximumBlockCount-prop">maximumBlockCount()</a>. The document is only as large as the number of blocks as far as <a href="qtextedit.html">QTextEdit</a> is concerned.</li>
<li>When adding text to a text edit, it is an advantage to add it in an edit block (see example below). The result is that the text edit does not need to build the entire document structure at once.</li>
</ul>
<p>We give an example of the latter technique in the list. We assume that the text edit is visible.</p>
<pre> textEdit.show();

 textCursor.beginEditBlock();

 for (int i = 0; i &lt; 1000; ++i) {
     textCursor.insertBlock();
     textCursor.insertText(paragraphText.at(i));
 }

 textCursor.endEditBlock();</pre>
<p>
[Previous: <a href="richtext-common-tasks.html">Common Rich Text Editing Tasks</a>]
[<a href="richtext.html">Contents</a>]
[Next: <a href="richtext-html-subset.html">Supported HTML Subset</a>]
</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
